package util;

import net.rim.device.api.system.Display;

public class Translator {
	int referenceWidth, referenceHeight;
	public static int currentWidth = Display.getWidth();
	public static int currentHeight = Display.getHeight();

	public Translator(int referenceWidth, int referenceHeight) {
		this.referenceWidth = referenceWidth;
		this.referenceHeight = referenceHeight;
	}

	public Position translate(int xReference, int yReference) {
		int displayX = xReference!= 0 ? currentWidth*xReference/referenceWidth : 0;
		int displayY = yReference!=0 ? currentHeight*yReference/referenceHeight : 0;
		return new Position(displayX,displayY);
	}
}
